package com.example.novelstory.controller.dxy;

import com.example.novelstory.entity.Category;
import com.example.novelstory.service.dxy.CategoryServicelmpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * author:daixiaoyi
 */


@Api(tags ="小说分类")
@CrossOrigin
@RestController
public class CategoryController {
    @Resource
    CategoryServicelmpl categoryService;

    @PostMapping(value = "/findcategoryAll")
//    @ResponseBody
    @ApiOperation(value = "全查")
    public List<Category> findcategoryAll() {
//        List<Category> allcategoryUser = categoryService.findcategoryAll();
        return categoryService.list();
    }

//    @ResponseBody
    @PostMapping(value = "/addcategory")
    @ApiOperation(value = "增加")
    public Boolean addcategoryInfo(Category category) {
//        List<Category> addcategoryInfo = categoryService.addcategoryInfo(title,pid,sort,meta_title,meta_keywords,meta_description,icon,template_index,template_detail,template_filter,link,create_time,update_time,status,type);
        return categoryService.addcategoryInfo(category);

    }

//    @ResponseBody
    @PostMapping(value = "/deletecategory")
    @ApiOperation(value = "删除")
    public Boolean deletecategoryInfo(int id) {
//        List<Category> deletecategoryInfo = categoryService.deletecategoryInfo(id);
        return categoryService.deletecategoryInfo(id);

    }

//    @ResponseBody
    @PostMapping(value = "/updetecategory")
    @ApiOperation(value = "修改")
    public Boolean updeteVipInfo(Category category) {
//        List<Category> updetecategoryInfo = categoryService.updetecategoryInfo(title,pid,sort,meta_title,meta_keywords,meta_description,icon,template_index,template_detail,template_filter,link,create_time,update_time,status,type);
        return categoryService.updetecategoryInfo(category);
    }
}
